package flc.ast.adapter;

import android.graphics.Color;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.TimeUtils;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.text.SimpleDateFormat;

import flc.ast.R;
import flc.ast.bean.FormatBean;
import flc.ast.bean.MyCollectBean;
import stark.common.basic.adaptermutil.StkEmptyProvider;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;

public class CollectAdapter extends StkProviderMultiAdapter<MyCollectBean> {

    public CollectAdapter() {
        addItemProvider(new StkEmptyProvider<>(112));
        addItemProvider(new CollectProvider());
    }

    private class CollectProvider extends BaseItemProvider<MyCollectBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_collect;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyCollectBean bean) {
            Glide.with(baseViewHolder.itemView).load(bean.getPath()).into((ImageView) baseViewHolder.getView(R.id.ivCollectItemImg));
            baseViewHolder.setText(R.id.tvCollectItemName,bean.getName());
            baseViewHolder.setText(R.id.tvCollectItemDate, TimeUtils.millis2String(bean.getTime(),new SimpleDateFormat("yyyy年MM月dd日")));
        }
    }

}
